//
//  firstViewModel.swift
//  AreaChainblock
//
//  Created by 赵佟越 on 2018/9/28.
//  Copyright © 2018年 zhaotongyue. All rights reserved.
//

import UIKit
import YYModel

@objcMembers
class firstViewModel:NSObject,YYModel {
    @objc var data : [firstViewModel]?
    var dke : String?
    var m : String?
    var n : String?
    var code : Int = 0
    var message : String?
    var content : String?
    var FanMsg : String?
    var EnMsg : String?
    
    
    override init() {
        super.init()
    }
    
    required convenience init?(coder aDecoder: NSCoder) {
        self.init()
        self.yy_modelInit(with: aDecoder)
    }
    
    func encode(with aCoder: NSCoder) {
        self.yy_modelEncode(with: aCoder)
    }
    
    static func modelCustomPropertyMapper() -> [String : Any]? {
        return ["ids":"id"]
    }
    static func modelContainerPropertyGenericClass() -> [String : Any]? {
        return ["data":firstViewModel.classForCoder()]
    }
    
    override var description: String {
        return yy_modelDescription()
    }
    
    class func getSavePath() -> String{
        let docPath = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)[0] as NSString
        let path = (docPath as String) + "/first.plist"
        print(path)
        return path
    }
    
    class func saveCityModel(cityArr:[firstViewModel]) {
        let path = getSavePath()
        NSKeyedArchiver.archiveRootObject(cityArr, toFile: path)
    }
    
    class func getCityModelFromDie() -> [firstViewModel]{
        let cityModel = NSKeyedUnarchiver.unarchiveObject(withFile: getSavePath())
        return cityModel as! [firstViewModel]
    }
    
    
}


